package com.example.demo.mapper;

import com.example.demo.domain.entity.TrainingSubmission;
import com.example.demo.domain.entity.VojSubmissions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.dto.LatestSubmissionResultDto;
import com.example.demo.dto.SolveProblemCountDto;
import com.example.demo.dto.SubmissionGroupDayDto;
import com.example.demo.dto.SubmissionGroupDayLanguageDto;
import com.example.demo.param.voj.SubmissionLatestQueryParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
* @author 00774904
* @description 针对表【voj_submissions】的数据库操作Mapper
* @createDate 2023-12-18 18:23:20
* @Entity com.example.demo.domain.entity.VojSubmissions
*/
public interface VojSubmissionsMapper extends BaseMapper<VojSubmissions> {

    Long createSubmission(@Param("problemId") Long problemId,
                          @Param("uid") Long uid,
                          @Param("languageId") Integer languageId,
                          @Param("code") String code);

    Long getTotalSolveProblemCountByUserId(@Param("uid") Long uid);

    List<SolveProblemCountDto> getSolveProblemCountGroupByProblemTag(@Param("uid") Long uid);

    List<LatestSubmissionResultDto> getSubmissionResult(@Param("pid") Long id,
                                                        @Param("uid") long uid,
                                                        @Param("offset") long offset,
                                                        @Param("size") long size);

    List<SubmissionGroupDayDto> getNumberOfSubmissionsGroupByDay(@Param("startTime") String startTimeString,
                                                                 @Param("endTime") String endTimeString,
                                                                 @Param("uid") Long uid,
                                                                 @Param("accept") boolean isAcceptedOnly);

    List<SubmissionGroupDayLanguageDto> getNumberOfSubmissionsGroupByDayAndLanguage(@Param("startTime") String startTimeString,
                                                                                    @Param("endTime") String endTimeString,
                                                                                    @Param("uid") Long uid,
                                                                                    @Param("accept") boolean isAcceptedOnly);

    List<SubmissionGroupDayDto> getNumberOfSubmissionsGroupByMonth(@Param("startTime") String startTime,
                                                                   @Param("endTime") String endTime,
                                                                   @Param("uid") Long uid,
                                                                   @Param("accept") boolean b);

    List<LatestSubmissionResultDto> getLatestSubmissionsList(@Param("param") SubmissionLatestQueryParam param,
                                                             @Param("offset") long offset);

    Long getLatestSubmissionsCount(@Param("param") SubmissionLatestQueryParam param);

    void updateJudgeResult(@Param("code") String code,
                           @Param("msg") String msg,
                           @Param("submissionId") long submissionId);
}




